<template>
  <div class="config">
    <el-form
      :model="config"
      :rules="rules"
      ref="ruleForm"
      label-width="80px"
      class="demo-ruleForm"
    >
      <el-form-item label="页面名称" prop="title">
        <el-input v-model="config.title"></el-input>
      </el-form-item>
      <el-form-item label="页面描述">
        <el-input
          v-model="config.description"
          placeholder="用户通过微信分享给朋友时，会自动显示页面描述"
        ></el-input>
      </el-form-item>
      <el-form-item label="背景颜色">
        <!-- show-alpha -->
        <el-color-picker
          v-model="config.color"
          color-format="hex"
          :predefine="defaultColor"
        />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>

export default {
  props: ['value','defaultColor'],
  data() {
    return {
      config: this.value ? this.value : {},
      rules: {
        title: [{ required: true, message: '请输入页面名称', trigger: 'blur' }]
      }
    }
  },
  watch: {
    config(newVal, oldVal) {
      this.$emit('input', newVal)
    },
    value(newVal) {
      this.config = newVal
    }
  },
 
}
</script>

<style lang="less">
.config {
  padding: 5px;
}
</style>
